package com.sy.simpleegg.platform.ychsdk.api

import com.sy.simpleegg.platform.ychsdk.bean.member.GetMemberLoginQrCode
import com.sy.simpleegg.platform.ychsdk.bean.member.MemberInfoResponse
import com.sy.simpleegg.platform.ychsdk.bean.member.QrCodeMemberInfoResponse
import com.sy.simpleegg.platform.ychsdk.bean.member.SaveCoinResult
import com.ych.ytdevicesdk.api.BaseResult
import io.reactivex.Observable
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.POST
import retrofit2.http.QueryMap


interface IMemberApi {
    /**
     * 会员登录
     *
     * @param token token
     * @param map   Number
     * @return 会员信息
     */
    @GET("/yunyouminipos/api/v1/Leaguer/SaleLeaguerInfo")
    fun memberLogin(
        @Header("Authorization") token: String?,
        @QueryMap map: Map<String?, Any?>?,
    ): Observable<BaseResult<MemberInfoResponse?>?>?

    /**
     * 获取会员登录二维码的
     *
     * @param token token
     * @param map   TransID
     * @return memberLoginCode
     */
    @GET("/yunyouminipos/api/v1/CoinExchange/LeaguerLogin")
    fun getMemberLoginCode(
        @Header("Authorization") token: String?,
        @QueryMap map: Map<String?, @JvmSuppressWildcards Any?>?,
    ): Observable<BaseResult<GetMemberLoginQrCode?>?>?

    /**
     * 会员提币
     *
     * @param token token
     * @param map   TransID
     * @return memberLoginCode
     */
    @GET("/yunyouminipos/api/v1/CoinExchange/ExtractCoin")
    fun getMemberExtractCoin(
        @Header("Authorization") token: String?,
        @QueryMap map: Map<String?, Any?>?,
    ): Observable<BaseResult<GetMemberLoginQrCode?>?>?

    /**
     * 会员存币
     *
     * @param token token
     * @param map   {
     * "LeaguerID": "75458",
     * "Num": 24375
     * }
     * @return memberLoginCode
     */
    @POST("/yunyouminipos/api/v1/Leaguer/DepositCurrency")
    fun postMemberSaveCoin(
        @Header("Authorization") token: String?,
        @Body map: Map<String?, @JvmSuppressWildcards Any?>?,
    ): Observable<BaseResult<SaveCoinResult?>?>?

    /**
     * 轮询会员登录状态
     *
     * @param token token
     * @param map   TransID 需要和 获取会员登录二维码的 transID 相同
     * @return 会员信息
     */
    @GET("/yunyouminipos/api/v1/CoinExchange/QueryLgLoginRes")
    fun memberLoginQuery(
        @Header("Authorization") token: String?,
        @QueryMap map: Map<String?, @JvmSuppressWildcards Any?>?,
    ): Observable<BaseResult<QrCodeMemberInfoResponse?>?>?

    /**
     * 核销渠道商品到会员账户
     *
     * @param token token
     * @param map   Code 团购码 ，LeaguerID 会员ID ，Amount 核销数量 ，Channel EnumChannelType [com.ych.cloudCoinDevice.config.Constants.EnumChannelType]
     * @return
     */
    @POST("/yunyouminipos/api/v1/KoubeiWriteOff/WriteOff")
    fun writeOffChannelGoodsToMember(
        @Header("Authorization") token: String?,
        @Body map: Map<String?, Any?>?,
    ): Observable<BaseResult<String?>?>?

}